package com.guli.statisticservice.schedule;

import com.guli.statisticservice.service.StatisticsDailyService;
import com.guli.statisticservice.utils.DateUtil;
import org.apache.commons.collections4.SplitMapUtils;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @ClassName ScheduleTask
 * @Description TODO
 * @Author YinLiangTao Email:1517535831@qq.com
 * @Date 2022/4/21 15:35
 * @Version 1.0
 */
@Component
public class ScheduleTask {
//    @Scheduled(cron = "0/5 * * * * ?")
//    public void testSchedule(){
//        System.out.println("lllllll");
//    }

    @Resource
    private StatisticsDailyService statisticsDailyService;

    @Scheduled(cron = "0 0 1 * * ?")
    public void exeute(){
        //刷新前一天的数据
        statisticsDailyService.createStatisticsByDay(DateUtil.formatDate(DateUtil.addDays(new Date(),-1)));
    }
}
